# _*_ coding:utf-8 _*_
# @author : Joyamon
# @time : 2023-1-10 11:48
# @file : set_report_title.py
import json
import os
from settings.settings import Route


class SetTitle:

    """
    设置标题名称
    """
    def __init__(self):
        self.file_path = str(Route().allure_results()) + os.path.join(r'\report\widgets\summary.json')

    def get_json_data(self, new_title):
        with open(self.file_path, 'rb')as f:
            params = json.load(f)
            params['reportName'] = new_title
            dict = params
        f.close()
        return dict

    def write_json_data(self, dict):
        with open(self.file_path, 'w', encoding='utf-8') as fp:
            json.dump(dict, fp, ensure_ascii=False, indent=4)
        fp.close()



